home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / recent / mcf4amrc.lha / MCF4AmIRC / Rexx / MCF_PROTECT.AMIRX < prev    next >
Text File  |  1996-12-14  |  5KB  |  10 lines

  1. /* MCF_PROTECT.AMIRX
  2. // $VER: MCF_PROTECT.AMIRX 4.9 (13.12.96)
  3. \\ Written by Donald T. Becker (dtbecker@prolog.net) IRC: StarDustr
  4. // Please mail any bug reports/comments to the above address with a subject
  5. \\ header of MCF.AMIRX.
  6. //
  7. \\ ** What to do with this file?
  8. // Put this script in REXX:        It will be used by MCF.AMIRX.
  9. */
  10. ;parse arg MCFenv junk;ppos=pos('.',MCFenv)+1;Client=substr(MCFenv,ppos);IGN="IGNORE."||Client;ignored=" ";EnvFName="MCF:MCF.Protect";if exists(EnvFName) then call EnvLoad;if Omissions="OMISSIONS" then;Omissions="";if CTCPMax="CTCPMAX" then;CTCPMax=5;if CTCPSize="CTCPSIZE" then;CTCPSize=512;if CTCPTime="CTCPTIME" then;CTCPTime=10;if PRIVMax="PRIVMAX" then;PRIVMax=26;if PRIVSize="PRIVSIZE" then;PRIVSize=5120;if PRIVTime="PRIVTIME" then;PRIVTime=35;if TEXTMax="TEXTMAX" then;TEXTMax=30;if TEXTSize="TEXTSIZE" then;TEXTSize=2048;if TEXTTime="TEXTTIME" then;TEXTTime=45;address value(MCFenv);options results;do forever;getline;APort=show('P',value(MCFenv));if APort=0 then exit;xpos=pos("!",line.prefix);if xpos=0 then iterate;if 0 ~=pos("SERVICE@DAL.NET",upper(line.prefix)) then iterate;UNick=upper(left(line.prefix,xpos-1));ypre=upper(substr(line.prefix,xpos+1));xpos=lastpos("@",ypre);UName=upper(left(ypre,xpos-1));UHost=upper(substr(ypre,xpos+1));getmynick;MyNick=upper(result);XFType="";if MyNick=UNick then;do;select;when 1=pos(":DROP",line.rest) then FType="DROP";when 1=pos(":%QUIT",line.rest) then FType="QUIT";otherwise iterate;end;call Prot_RTN();iterate;end;select;when 2=pos('01'x,line.rest) then;do;FType="CTCP";XFType="CTCP";end;when 0 ~=pos("PRIVMSG",line.command) then FType="PRIV";when 0 ~=pos("NOTICE",line.command) then FType="PRIV";otherwise iterate;end;parse value line.rest with xcmd junk;if upper(line.dest) ~=MyNick then;FType="TEXT";else;do;xline=':'||'01'x||'ACTION :';if 0 ~=pos(xcmd,xline) then XFType="";end;Flood=line.rest||frest;Fsize=length(Flood);select;when line.command="NOTICE" then;do;xline=':'||'01'x||'ACTION :'||'01'x||'CLIENTINFO :'||'01'x||'ECHO :'||'01'x||'FINGER :'||'01'x||'SOURCE :'||'01'x||'TIME :'||'01'x||'USERINFO :'||'01'x||'VERSION';if 0 ~=pos(xcmd,xline) then;TFsize=1;else TFsize=Fsize*2;end;when 0 ~=pos('ACTION',line.rest) then TFsize=1;when 0 ~=pos('CLIENTINFO',line.rest) then TFsize=175;when 0 ~=pos('ECHO',line.rest) then TFsize=Fsize*10;when 0 ~=pos('FINGER',line.rest) then TFsize=155;when 0 ~=pos('SOURCE',line.rest) then TFsize=155;when 0 ~=pos('TIME',line.rest) then TFsize=150;when 0 ~=pos('USERINFO',line.rest) then TFsize=210;when 0 ~=pos('VERSION',line.rest) then TFsize=240;otherwise TFsize=Fsize;end;Fsize=TFsize;call Prot_RTN();end;Prot_RTN:;if FType="QUIT" then exit;if FType="DROP" then;parse value line.rest with junk UName UHost junk;UxName=translate(UName,"ZZ","-~");UxHost=translate(UHost,"ZZ","-~");UiHost="*!*@"||UHost;Omit="N";if 0 ~=pos(UHost,Omissions) then;do;UiHost="*!"||UName||"@"||UHost;UxHost=UxName||UxHost;Omit="Y";end;if FType="DROP" then;do;"Say /UnIgnore "UiHost;"RAW Silence -"UiHost;UHost1="CTCP"||UxHost;UHost2="PRIV"||UxHost;UHost3="TEXT"||UxHost;interpret "DROP " UHost1;interpret "DROP " UHost2;interpret "DROP " UHost3;ipos=pos(UiHost,ignored);if ipos=0 then return;if ipos=2 then;parse value ignored with junk ignored;else;do;ig1=left(ignored,ipos-2);ig2=substr(ignored,ipos);parse value ig2 with junk ig3;ignored=ig1||ig3;end;call setclip(IGN,ignored);return;end;if XFType="CTCP" then;do;XType=FType;XFType=XFType FType;FType="CTCP";end;if XFType="" then XFType=FType;LDName=FType||UxHost;XDName="";if XType ~="" then XDName=XType||UxHost;if value(LDName)='Y' then;do;if XType=FType then;return;else;do;XDName=XType||UxHost;if value(XDName)='Y' then return;LDName=XDName;call DoIgnore();return;end;end;tme=time(s);if upper(LDName)=value(LDName) then;do;interpret LDName "= tme 1 Fsize";return;end;interpret "parse value "value(LDName)" with ltme lcnt tsize junk";if ltme>tme then tme=tme+86400;diff=tme-ltme;xtime=FType||Time;if diff>value(xtime) then;do;interpret LDName "= tme 1 Fsize";return;end;xmax=FType||Max;xsiz=FType||Size;lcnt=lcnt+1;tsize=tsize+Fsize;if lcnt>value(xmax)|tsize>value(xsiz) then;do;call DoIgnore();return;end;interpret LDName "= ltme lcnt tsize";return;DoIgnore:;if FType ~='TEXT' then "RAW Silence "UiHost;"Say /Ignore "UiHost XFType;interpret LDName "= 'Y'";if XDName ~="" then interpret XDName "= 'Y'";if 0 ~=pos(UiHost,ignored) then return;ignored=ignored UiHost||' ';call setclip(IGN,ignored);return;EnvLoad:;validnames="OMIT CTCPMAX CTCPSIZE CTCPTIME PRIVMAX PRIVSIZE PRIVTIME TEXTMAX TEXTSIZE TEXTTIME";Omissions="";call open("Input",EnvFName,'R');xx=upper(readln("Input"));do until eof("Input");parse value xx with envname envvalue junk;if 0 ~=pos(envname,validnames) then;if envname="OMIT" then;Omissions=Omissions envvalue;else interpret envname "= envvalue";xx=upper(readln("Input"));end;call close("Input");return